package com.ruoyi.examination.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.examination.dto.ExamRecordSpecialDto;
import com.ruoyi.examination.util.SnowflakeIdUtils;
import com.ruoyi.examination.vo.ExamRecordSelectVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.examination.mapper.ExamRecordSpecialMapper;
import com.ruoyi.examination.domain.ExamRecordSpecial;
import com.ruoyi.examination.service.IExamRecordSpecialService;

/**
 * 考试记录-特种设备Service业务层处理
 * 
 * @author hcc
 * @date 2025-11-03
 */
@Service
public class ExamRecordSpecialServiceImpl implements IExamRecordSpecialService 
{
    @Autowired
    private ExamRecordSpecialMapper examRecordSpecialMapper;

    /**
     * 查询考试记录-特种设备
     * 
     * @param examRecordId 考试记录-特种设备主键
     * @return 考试记录-特种设备
     */
    @Override
    public ExamRecordSpecial selectExamRecordSpecialByExamRecordId(String examRecordId)
    {
        return examRecordSpecialMapper.selectExamRecordSpecialByExamRecordId(examRecordId);
    }

    /**
     * 查询考试记录-特种设备列表
     * 
     * @param examRecordSpecial 考试记录-特种设备
     * @return 考试记录-特种设备
     */
    @Override
    public List<ExamRecordSpecial> selectExamRecordSpecialList(ExamRecordSpecial examRecordSpecial)
    {
        return examRecordSpecialMapper.selectExamRecordSpecialList(examRecordSpecial);
    }

    /**
     * 新增考试记录-特种设备
     * 
     * @param examRecordSpecial 考试记录-特种设备
     * @return 结果
     */
    @Override
    public int insertExamRecordSpecial(ExamRecordSpecial examRecordSpecial)
    {
        examRecordSpecial.setCreateBy(SecurityUtils.getUsername());
        examRecordSpecial.setExamRecordId(String.valueOf(new SnowflakeIdUtils(5,8).nextId()));
        examRecordSpecial.setCreateTime(DateUtils.getNowDate());
        return examRecordSpecialMapper.insertExamRecordSpecial(examRecordSpecial);
    }

    /**
     * 修改考试记录-特种设备
     * 
     * @param examRecordSpecial 考试记录-特种设备
     * @return 结果
     */
    @Override
    public int updateExamRecordSpecial(ExamRecordSpecial examRecordSpecial)
    {
        examRecordSpecial.setUpdateTime(DateUtils.getNowDate());
        return examRecordSpecialMapper.updateExamRecordSpecial(examRecordSpecial);
    }

    /**
     * 批量删除考试记录-特种设备
     * 
     * @param examRecordIds 需要删除的考试记录-特种设备主键
     * @return 结果
     */
    @Override
    public int deleteExamRecordSpecialByExamRecordIds(String[] examRecordIds)
    {
        return examRecordSpecialMapper.deleteExamRecordSpecialByExamRecordIds(examRecordIds);
    }

    /**
     * 删除考试记录-特种设备信息
     * 
     * @param examRecordId 考试记录-特种设备主键
     * @return 结果
     */
    @Override
    public int deleteExamRecordSpecialByExamRecordId(String examRecordId)
    {
        return examRecordSpecialMapper.deleteExamRecordSpecialByExamRecordId(examRecordId);
    }

    /**
     * 查询考试记录列表
     */
    @Override
    public List<ExamRecordSpecialDto> getExamSpecialList(ExamRecordSelectVo examRecordSelectVo) {
        return examRecordSpecialMapper.getExamSpecialList(examRecordSelectVo);
    }
}
